package com.epam.lissina.entity;

import java.util.Arrays;
import java.util.List;

import com.epam.lissina.collector.Collect;
import com.epam.lissina.separator.TextSeparator;

public class Listing implements IParagraph {

	private List<String> listing;

	public Listing(String[] codeLines) {
		listing = Arrays.asList(codeLines);
	}

	public List<String> getListing() {
		return listing;
	}

	@Override
	public String toString() {
		return Collect.join(listing, TextSeparator.ENTER);
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((listing == null) ? 0 : listing.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Listing other = (Listing) obj;
		if (listing == null) {
			if (other.listing != null)
				return false;
		} else if (!listing.equals(other.listing))
			return false;
		return true;
	}
}
